<?php
if( !$LANG = $GLOBALS['lang'] ) {
	$LANG = "en";
}
define("LANG",$LANG);
define("ADMIN_DIR",__DIR__."/admin/");
function __autoload($classname) {
	$classname = strtolower($classname);
	$arr = explode("_", $classname);
	if( count($arr) == 1 ) {
		$classPath = "core/".$arr[0]; 
	} else {
		$classPath = implode("/", $arr);
	}
	$path = __DIR__."/lib/".$classPath .".php";
	$errorPath = __DIR__."/languages/".$LANG."/error/".$classPath .".php"; 
	$localPath = __DIR__."/languages/".$LANG."/".$classPath .".php";
	if( file_exists($path) ) {
		include_once($path);
	}
	if( file_exists($errorPath) ) {
		include_once($errorPath);
	}
	if( file_exists($localPath) ) {
		include_once($localPath);
	}
 }
/*==================ERROR==================*/
require_once("languages/{$LANG}/error/common.php");
?>